Skip to content

dism resource: add sourcePath parameter to allow for offline feature installs#1561

Open
Alex-shearing wants to merge 18 commits into
PowerShell:mainfrom
Alex-shearing:optionalfeaturesource
Open

dism resource: add sourcePath parameter to allow for offline feature installs#1561
Alex-shearing wants to merge 18 commits into
PowerShell:mainfrom
Alex-shearing:optionalfeaturesource

Conversation

@Alex-shearing

@Alex-shearing Alex-shearing commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

To allow Windows optional features and feature on demand installs on Windows computers without internet access, the source paramter must be accessible to supply offline resources.

This is available as the 'Source' paramter in:

The changes include:

  • Add sourcePath property to Microsoft.Windows/FeatureOnDemandList and Microsoft.Windows/OptionalFeatureList schemas
  • Add the source_paths paramter to enable_feature and add_capability functions in dism.rs
    • This paramter is passed into the add_capability/enable_feature DISM functions
  • Resource reference docs updated to include new parameter

@Alex-shearing Alex-shearing marked this pull request as ready for review June 5, 2026 10:37
Copilot AI review requested due to automatic review settings June 5, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for specifying DISM sourcePaths when enabling optional features/capabilities, enabling offline/alternate source installation scenarios.

Changes:

  • Extend OptionalFeatureList/FeatureOnDemandList inputs/outputs with an optional sourcePaths array.
  • Validate sourcePaths in set handlers and pass them into DISM calls.
  • Update resource schemas and docs to document the new property and examples.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
resources/dism_dsc/src/optional_feature/types.rs Adds source_paths field to OptionalFeatureList model.
resources/dism_dsc/src/optional_feature/set.rs Validates/passes source_paths into enable operation; includes in output.
resources/dism_dsc/src/optional_feature/get.rs Includes source_paths in Get output payload.
resources/dism_dsc/src/optional_feature/export.rs Sets source_paths: None in Export output.
resources/dism_dsc/src/feature_on_demand/types.rs Adds source_paths field to FeatureOnDemandList model.
resources/dism_dsc/src/feature_on_demand/set.rs Validates/passes source_paths into add capability; includes in output.
resources/dism_dsc/src/feature_on_demand/get.rs Includes source_paths in Get output payload.
resources/dism_dsc/src/feature_on_demand/export.rs Sets source_paths: None in Export output.
resources/dism_dsc/src/dism.rs Extends DISM FFI calls to pass SourcePaths/SourcePathCount.
resources/dism_dsc/optionalfeature.dsc.resource.json Adds sourcePaths to resource schema.
resources/dism_dsc/featureondemand.dsc.resource.json Adds sourcePaths to resource schema.
resources/dism_dsc/locales/en-us.toml Adds localized error string for invalid source path.
docs/reference/resources/Microsoft/Windows/OptionalFeatureList/index.md Documents sourcePaths and updates links.
docs/reference/resources/Microsoft/Windows/OptionalFeatureList/examples/enable-disable-optional-features.md Adds example using offline source.
docs/reference/resources/Microsoft/Windows/FeatureOnDemandList/index.md Documents sourcePaths and adds link.
docs/reference/resources/Microsoft/Windows/FeatureOnDemandList/examples/install-remove-feature-on-demand.md Adds example using offline source.

Comment thread resources/dism_dsc/src/dism.rs Outdated
Comment thread resources/dism_dsc/src/optional_feature/set.rs Outdated
Comment thread resources/dism_dsc/src/feature_on_demand/set.rs Outdated
Comment thread resources/dism_dsc/src/optional_feature/get.rs Outdated
Comment thread resources/dism_dsc/locales/en-us.toml Outdated
@Alex-shearing Alex-shearing marked this pull request as draft June 5, 2026 10:46
@Alex-shearing Alex-shearing marked this pull request as ready for review June 5, 2026 11:16
@Alex-shearing Alex-shearing requested a review from Copilot June 5, 2026 11:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.

Comment thread resources/dism_dsc/src/dism.rs Outdated
Comment thread resources/dism_dsc/src/optional_feature/get.rs Outdated
Comment thread resources/dism_dsc/src/feature_on_demand/get.rs
Comment thread docs/reference/resources/Microsoft/Windows/OptionalFeatureList/index.md Outdated
Comment thread resources/dism_dsc/src/optional_feature/get.rs Outdated
@Alex-shearing Alex-shearing requested a review from Copilot June 5, 2026 11:47

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Comment thread resources/dism_dsc/src/optional_feature/types.rs
Comment thread resources/dism_dsc/src/feature_on_demand/types.rs
Comment thread resources/dism_dsc/src/optional_feature/set.rs
Comment thread resources/dism_dsc/src/dism.rs
Comment thread resources/dism_dsc/src/optional_feature/get.rs

@SteveL-MSFT SteveL-MSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, @Alex-shearing you tested this locally? @michaeltlombardi can you do a docs pass on this? Thanks.

@Alex-shearing

Copy link
Copy Markdown
Contributor Author

This looks fine to me, @Alex-shearing you tested this locally? @michaeltlombardi can you do a docs pass on this? Thanks.

Yes, tested successfully on my local. My testing included multiple full removals and re-installs of the features, while disconnected from the internet (with a local SxS file)

@SteveL-MSFT

Copy link
Copy Markdown
Member

@Alex-shearing can you resolve the merge conflict?

@michaeltlombardi michaeltlombardi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting some changes mostly centered on updating the JSON Schema to more correctly represent the property (write-only, minimum count, uniqueness).

Comment on lines +99 to +103
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
They define the desired state for an instance of the resource.

- [sourcePaths](#sourcePaths) - The location of the source files to use for installation if
necessary.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is more correctly a write-only property, given that it only affects how the resource behaves during a Set operation.

Instance properties typically represent actual properties of the underlying resource (like the name of the feature and whether it exists) where write-only properties affect how the resource behaves and read-only properties are metadata about the resource that the user can't directly and idempotently manage (like the last write time for a file or the author for a software package).

Suggested change
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
They define the desired state for an instance of the resource.
- [sourcePaths](#sourcePaths) - The location of the source files to use for installation if
necessary.
- **Write-only properties:** <a id="write-only-properties"></a> The resource accepts the following
properties that affect its behavior but can't be retrieved for the actual state of an instance.
For more information about read-only properties, see the "Write-only resource properties" section
in [DSC resource properties][aa].
- [sourcePaths](#sourcePaths) - The location of the source files to use for installation if
necessary.

Comment on lines +288 to +304
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>

```yaml
Type : array
IsRequired : false
IsKey : false
IsReadOnly : false
```

</details>

Supplied at the top level of the **Set** operation, indicates the location of the source files to
use for installation if necessary. The DISM API will search these paths if the feature files are
not available in the local feature store. See the [feature on demand repository documentation][08]
for more information on valid sources.

This property is optional and will be omitted from the response if no value is provided.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>
```yaml
Type : array
IsRequired : false
IsKey : false
IsReadOnly : false
```
</details>
Supplied at the top level of the **Set** operation, indicates the location of the source files to
use for installation if necessary. The DISM API will search these paths if the feature files are
not available in the local feature store. See the [feature on demand repository documentation][08]
for more information on valid sources.
This property is optional and will be omitted from the response if no value is provided.
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>
```yaml
Type : array
ItemsType : string
ItemsMinimumCount : 1
ItemsMustBeUnique : true
IsRequired : false
IsKey : false
IsReadOnly : false
IsWriteOnly : true
```
</details>
Indicates where the resource should look for source files to install a feature when the feature
files aren't available in the local feature store for offline systems. Specify this property as an
array of one or more unique strings where each string represents the path to a source file to use.
This property affects how the resource behaves during **Set** operations. It has no affect for any
other resource operations. For more information about valid sources for the DISM API, see the
[`/Enable-Feature` reference for the `dism` command][08].

Comment on lines +343 to +348
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
}
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
}
},
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},

Comment on lines +97 to +98
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
They define the desired state for an instance of the resource.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Instance properties:** <a id="instance-properties"></a> The following properties are optional.
They define the desired state for an instance of the resource.
- **Write-only properties:** <a id="write-only-properties"></a> The resource accepts the following
properties that affect its behavior but can't be retrieved for the actual state of an instance.
For more information about read-only properties, see the "Write-only resource properties" section
in [DSC resource properties][aa].

[06]: ../FeatureOnDemandList/index.md
[07]: /windows-server/administration/windows-commands/dism/dism-operating-system-package-servicing-command-line-options
[07]: /windows-hardware/manufacture/desktop/deployment-image-servicing-and-management--dism--command-line-options
[08]: /windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options#enable-feature No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[08]: /windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options#enable-feature
[08]: /windows-hardware/manufacture/desktop/dism-operating-system-package-servicing-command-line-options#enable-feature
[aa]: ../../../../../concepts/resources/properties.md#write-only-resource-properties

[05]: ../../../../../concepts/resources/properties.md#read-only-resource-properties
[06]: ../OptionalFeatureList/index.md
[07]: /windows-hardware/manufacture/desktop/features-on-demand-v2--capabilities
[08]: /windows-hardware/manufacture/desktop/features-on-demand-v2--capabilities?view=windows-11#fod-repositories No newline at end of file

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[08]: /windows-hardware/manufacture/desktop/features-on-demand-v2--capabilities?view=windows-11#fod-repositories
[08]: /windows-hardware/manufacture/desktop/features-on-demand-v2--capabilities?view=windows-11#fod-repositories
[aa]: ../../../../../concepts/resources/properties.md#write-only-resource-properties

Comment on lines +273 to +289
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>

```yaml
Type : array
IsRequired : false
IsKey : false
IsReadOnly : false
```

</details>

Supplied at the top level of the **Set** operation, indicates the location of the source files to
use for installation if necessary. The DISM API will search these paths if the feature files are
not available in the local feature store. See the [DISM enable feature documentation][08] for more
information on valid sources.

This property is optional and will be omitted from the response if no value is provided.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>
```yaml
Type : array
IsRequired : false
IsKey : false
IsReadOnly : false
```
</details>
Supplied at the top level of the **Set** operation, indicates the location of the source files to
use for installation if necessary. The DISM API will search these paths if the feature files are
not available in the local feature store. See the [DISM enable feature documentation][08] for more
information on valid sources.
This property is optional and will be omitted from the response if no value is provided.
<details><summary>Expand for <code>sourcePaths</code> property metadata</summary>
```yaml
Type : array
ItemsType : string
ItemsMinimumCount : 1
ItemsMustBeUnique : true
IsRequired : false
IsKey : false
IsReadOnly : false
IsWriteOnly : true
```
</details>
Indicates where the resource should look for source files to install a feature when the feature
files aren't available in the local feature store for offline systems. Specify this property as an
array of one or more unique strings where each string represents the path to a source file to use.
This property affects how the resource behaves during **Set** operations. It has no affect for any
other resource operations. For more information about valid sources for the DISM API, see the
[`/Enable-Feature` reference for the `dism` command][08].

Comment on lines +328 to 333
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
}
},

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
}
},
"sourcePaths": {
"type": "array",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true
},

Comment on lines +120 to +126
"sourcePaths": {
"type": "array",
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"sourcePaths": {
"type": "array",
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
}
"sourcePaths": {
"type": "array",
"writeOnly": true,
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true

Comment on lines +119 to +125
"sourcePaths": {
"type": "array",
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"sourcePaths": {
"type": "array",
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
}
"sourcePaths": {
"type": "array",
"writeOnly": true,
"title": "Source paths",
"description": "An array of paths to feature files if the files are not available in the local feature store. This is an optional property for set operations and is ignored for get operations.",
"items": {
"type": "string"
},
"minItems": 1,
"uniqueItems": true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants